package com.test.action;

import java.util.List;

import com.test.entity.Orders;
import com.test.entity.UserInfo;
import com.test.service.OrdersService;
import com.test.util.PageUtil;

public class ShoppingRecordsAction extends BaseAction {
	private OrdersService ordersService;
	private int curpage1;
	private String orderId;

	public String shopcart() throws Exception {
		UserInfo userInfo = (UserInfo) this.getSession().get("userInfo");
		Integer id = userInfo.getId();
		int countInteger = ordersService.queryRecordAmount(id);
		PageUtil pageUtil = new PageUtil(countInteger, 3);
		pageUtil.count(curpage1);
		List<Orders> orderlist = ordersService.queryAll(pageUtil.getPageSize(),
				curpage1, id);
		this.getRequest().put("pageUtil", pageUtil);
		this.getRequest().put("orderlist", orderlist);
		return "user4";
	}

	public String showResult() throws Exception {
		List<Orders> listorList = ordersService.queryorderdetail(orderId);
		this.getRequest().put("listorList", listorList);
		return "user5";
	}

	public OrdersService getOrdersService() {
		return ordersService;
	}

	public void setOrdersService(OrdersService ordersService) {
		this.ordersService = ordersService;
	}

	public int getCurpage1() {
		return curpage1;
	}

	public void setCurpage1(int curpage1) {
		this.curpage1 = curpage1;
	}

	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}

}